package com.msk.web.controller.basic;

import com.msk.common.core.controller.BaseController;
import com.msk.common.core.domain.R;
import com.msk.third.service.OssStsTokenMpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @BelongsProject: msk
 * @BelongsPackage: com.msk.mp.controller.system
 * @Author: dz
 * @CreateTime: 2022-06-27  11:37
 * @Description: 获取oss token信息
 * @Version: 1.0
 */
@RestController
@RequestMapping("/api/mp/aliOss/sys")
public class OssTokenMpController extends BaseController {

    @Autowired
    private OssStsTokenMpService ossStsTokenMpService;

    @GetMapping("/getAccessToken/{type}")
    public R<?> getAccessToken(@PathVariable("type") String type){
        Map<String, Object> tokenInfo = ossStsTokenMpService.getTokenInfo(type);
        if (tokenInfo.size() > 0) {
            return R.appOk(tokenInfo,"查询成功");
        }
        return R.appFail("",2002,"获取失败");
    }

}
